import 'package:sleep/help_style.dart';
import 'package:flutter/material.dart';
import 'package:sleep/model/blue_connection_state.dart';
import 'package:sleep/page/blue/blue_item_type.dart';

class ScanItem extends StatelessWidget {
  final String name;
  final String blueId;
  final ValueChanged<BlueType> ontap;

  const ScanItem({
    Key? key,
    required this.ontap,
    required this.name,
    required this.blueId,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return child();
  }

  Widget child() {
    return Container(
      margin: EdgeInsets.all(HelpStyle.cellMargin),
      padding: EdgeInsets.all(HelpStyle.cellMargin),
      decoration: HelpStyle.decoration,
      child: Row(
        children: [
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  name,
                  style: HelpStyle.titleStyle,
                ),
                const SizedBox(height: 4),
                Text(
                  blueId,
                  style: HelpStyle.contextStyle,
                ),
                const SizedBox(height: 4),
                BlueItemTypeWidget(onTap: ontap),
              ],
            ),
          ),
          const SizedBox(height: 4),
        ],
      ),
    );
  }
}
